<?php

/**
 * 展开或运算
 */
function explodeOr($sum)
{
  if($sum >= 1){
    if($sum === 1){
      return [$sum];
    }

    $t = 1;
    $arr = [];
    while($t < $sum){
      if($t & $sum){
        $arr[] = $t;
      }
      $t <<= 1;
    }

    return $arr;
  }
}


/**
 * 交换
 */
function switchNumber($a,$b)
{
  $a = $a + $b;
  $b = $a - $b;
  $a = $a - $b;

  return ['a'=>$a,'b'=>$b];
}


print_r(switchNumber(1,3));
print_r(explodeOr(300));